package com.sitanyun.merchant.guide.adapter;

import android.content.Context;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sitanyun.merchant.guide.R;
import com.sitanyun.merchant.guide.bean.TrajeBean;
import com.sitanyun.merchant.guide.weiht.NoScrollListView;

/**
 * Created by jzl
 * on 2022/2/8.
 */
//用户轨迹
public class RecTraListAdatper extends BaseQuickAdapter<TrajeBean.DataBean, BaseViewHolder> {

    public RecTraListAdatper(Context context) {
        super(R.layout.tralist_item);
        this.mContext = context;
    }


    @Override
    protected void convert(BaseViewHolder helper, TrajeBean.DataBean item) {
        helper.setText(R.id.create_time,item.getDate());
        View views= helper.getView(R.id.views);
        if (helper.getPosition()>0){
            views.setVisibility(View.VISIBLE);
        }else {
            views.setVisibility(View.INVISIBLE);
        }
        helper.setText(R.id.shar,"浏览"+item.getBrowseNum()+"次");
        int intTime= item.getDuration();
        int h=intTime/3600;
        int m=(intTime%3600)/60;
        int s=(intTime%3600)%60;
        if (h==0){
            helper.setText(R.id.shar_times,"活动时长"+m+"分"+s+"秒");
//            shar_times.setText("活动时长"+m+"分"+s+"秒");
        }else {
            helper.setText(R.id.shar_times,"活动时长"+h+"时"+m+"分钟");
           // shar_times.setText("活动时长"+h+"时"+m+"分钟");
        }
        NoScrollListView mlistView=  helper.getView(R.id.list_traje);
      //  NoScrollListView mlistView = (NoScrollListView) convertView.findViewById(R.id.list_traje);
        TrajeListsAdapter trajeListsAdapter= new TrajeListsAdapter(mContext,item.getList());
        mlistView.setAdapter(trajeListsAdapter);

    }
}